package com.work.dyduser.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author WZ 2016/2/4 时间相关工具类
 */
public class TimeUtil {
    public static String getTime() {
        long time = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date d1 = new Date(time);
        return format.format(d1);
    }

    public static String getTimeDetails() {
        long time = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        Date d1 = new Date(time);
        return format.format(d1);

    }

    public static String getTimeYMD() {
        long time = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Date d1 = new Date(time);
        return format.format(d1);
    }

    public static String getTimeYear() {
        long time = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
        SimpleDateFormat format = new SimpleDateFormat("yyyy");
        Date d1 = new Date(time);
        return format.format(d1);
    }

    public static String getTimeMonth() {
        long time = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
        SimpleDateFormat format = new SimpleDateFormat("MM");
        Date d1 = new Date(time);
        return format.format(d1);
    }

    public static String getTimeDay() {
        long time = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
        SimpleDateFormat format = new SimpleDateFormat("dd");
        Date d1 = new Date(time);
        return format.format(d1);
    }
}
